package com.zuxia.impservices;

import java.util.List;
import java.util.Map;

import org.apache.commons.collections.map.HashedMap;

import com.zuxia.iDao.AdmininfoDAOI;
import com.zuxia.iDao.StaffindoDAOI;
import com.zuxia.iservices.LoginServicesI;
import com.zuxia.po.Admininfo;

/**
 * 用于处理登陆的业务逻辑层
 * @author 谌华勇
 *
 * 2018-11-12上午10:21:30
 */
public class LoginServices implements LoginServicesI {
	/**
	 * 管理员dao接口
	 */
	public AdmininfoDAOI admininfoDAO;
	/**
	 * 员工dao接口
	 */
	public StaffindoDAOI staffindoDAO;
	/**
	 * 登陆业务
	 * @param phone手机号
	 * @param pwd密码
	 * @return
	 */
	public Map<String, Object> selUserByPhoneAndPwd(String phone, String pwd) {
		//先尝试在管理员表中查找
		Map<String, Object> map = admininfoDAO.selUserByPhoneAndPwd(phone, pwd);
		if (map.size()==0) {
			//在员工表中查找
			 map = staffindoDAO.selUserByPhoneAndPwd(phone, pwd);
		}
		return map;
	}
	
	
	public AdmininfoDAOI getAdmininfoDAO() {
		return admininfoDAO;
	}
	public void setAdmininfoDAO(AdmininfoDAOI admininfoDAO) {
		this.admininfoDAO = admininfoDAO;
	}
	public StaffindoDAOI getStaffindoDAO() {
		return staffindoDAO;
	}
	public void setStaffindoDAO(StaffindoDAOI staffindoDAO) {
		this.staffindoDAO = staffindoDAO;
	}
	
}
